/**
 * globalThis https://blog.csdn.net/qq449245884/article/details/104322516
 * Optional chaining
 */
var a11 = 100
console.log(self.a)
console.log(window.window === window)


console.log(window)
console.log(self)
console.log(global)
console.log(globalThis);

const user = {
  address: {
    street: 'aaa',
    getNum(){
      return 100
    }
  }
}

const street = user && user.address && user.address.street
console.log(street)
const street2 = user?.address?.street
const num = user?.address?.getNum?.()
console.log(num)

// 空值合并 Nullish Coalescing Operation
const b = 0       // false ''
const a = b || 5  // undefined null
const a1 = b ?? 6
console.log(a, a1)